<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover, user-scalable=no">
        <meta name="color-scheme" content="light dark">
        <link rel="stylesheet" href="css/index.css">
        <title>五子棋游戏 - 坚果派</title>
    </head>
    <body>
        <div class="app">
            <!-- 游戏头部 -->
            <header class="game-header">
                <h1>🎮 五子棋</h1>
                <p class="author">by 坚果派</p>
            </header>

            <!-- 游戏信息栏 -->
            <div class="game-info">
                <div class="status-panel">
                    <div class="current-player">
                        <span class="label">当前玩家：</span>
                        <span id="currentPlayer" class="player black">⚫ 黑方</span>
                    </div>
                    <div class="game-status">
                        <span id="gameStatus">游戏进行中</span>
                    </div>
                </div>
                <div class="score-panel">
                    <div class="score-item">
                        <span class="player-icon black">⚫</span>
                        <span class="score-label">黑方：</span>
                        <span id="blackScore" class="score">0</span>
                    </div>
                    <div class="score-divider">vs</div>
                    <div class="score-item">
                        <span class="player-icon white">⚪</span>
                        <span class="score-label">白方：</span>
                        <span id="whiteScore" class="score">0</span>
                    </div>
                </div>
            </div>

            <!-- 棋盘容器 -->
            <div class="board-container">
                <canvas id="gameBoard" width="450" height="450"></canvas>
            </div>

            <!-- 控制按钮 -->
            <div class="game-controls">
                <button id="restartBtn" class="btn btn-primary">
                    <span class="btn-icon">🔄</span>
                    <span class="btn-text">重新开始</span>
                </button>
                <button id="undoBtn" class="btn btn-secondary">
                    <span class="btn-icon">↩️</span>
                    <span class="btn-text">悔棋</span>
                </button>
                <button id="rulesBtn" class="btn btn-info">
                    <span class="btn-icon">📖</span>
                    <span class="btn-text">规则</span>
                </button>
            </div>

            <!-- 规则说明弹窗 -->
            <div id="rulesModal" class="modal">
                <div class="modal-content">
                    <div class="modal-header">
                        <h2>📖 游戏规则</h2>
                        <span class="close">&times;</span>
                    </div>
                    <div class="modal-body">
                        <h3>基本规则：</h3>
                        <ul>
                            <li>🎯 两人对弈，黑方先行</li>
                            <li>⚫ 黑白双方轮流在棋盘交叉点落子</li>
                            <li>🏆 先在横、竖、斜任意方向连成五子者获胜</li>
                            <li>🔄 可以点击"悔棋"撤销上一步</li>
                            <li>♟️ 棋盘大小：15×15</li>
                        </ul>
                        <h3>获胜条件：</h3>
                        <p>在水平、垂直或斜向任意方向连续出现五个相同颜色的棋子即为获胜。</p>
                        <h3>提示：</h3>
                        <p>💡 先手优势明显，建议采用三手交换规则或五手N打等专业规则进行平衡。</p>
                    </div>
                    <div class="modal-footer">
                        <button class="btn btn-primary close-modal">我知道了</button>
                    </div>
                </div>
            </div>

            <!-- 胜利弹窗 -->
            <div id="winModal" class="modal">
                <div class="modal-content win-modal">
                    <div class="modal-header">
                        <h2 id="winTitle">🎉 获胜</h2>
                    </div>
                    <div class="modal-body">
                        <div class="win-animation">
                            <div class="trophy">🏆</div>
                        </div>
                        <p id="winMessage" class="win-message"></p>
                    </div>
                    <div class="modal-footer">
                        <button id="playAgainBtn" class="btn btn-primary">再来一局</button>
                    </div>
                </div>
            </div>

            <!-- Cordova 就绪提示 -->
            <div id="deviceready" class="device-ready-indicator">
                <span class="indicator-dot"></span>
                <span class="indicator-text">Cordova Ready</span>
            </div>
        </div>
        <script src="cordova.js"></script>
        <script src="js/index.js"></script>
    </body>
</html>
